<template>
  <div>
    <MyHeader title="购物车案例"></MyHeader>
    <div style="padding: 45px 0 50px">
      <MyGoods v-for="item in list" :key="item.id" :item="item"></MyGoods>
    </div>
    <MyFooter :list="list"></MyFooter>
  </div>
</template>

<script>
import MyFooter from "./components/MyFooter.vue";
import MyGoods from "./components/MyGoods.vue";
import MyHeader from "./components/MyHeader.vue";
export default {
  components: {
    MyHeader,
    MyFooter,
    MyGoods,
  },
  data() {
    return {
      list: [],
    };
  },
  created() {
    this.$axios({
      url: "/api/cart",
    })
      .then((res) => {
        console.log(res);
        this.list = res.data.list;
      })
      .catch((err) => console.error(err));
  },
};
</script>

<style>
</style>